package com.ssq.mobilehelper.aes;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.RatingBar;
import android.widget.Spinner;
import android.widget.TextView;

import com.ssq.mobilehelper.R;

import java.util.List;

/**
 * Created by Administrator on 2017/4/5.
 */

public class EncryAdapter extends BaseAdapter {
    private Context context;
    public  static List<EncryptBean> list;

    public EncryAdapter(Context context, List<EncryptBean> list) {
        this.context = context;
        this.list = list;
    }

    public void setAdapter(List<EncryptBean> li)
    {
        list  = li;
    }



    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int i) {
        return list.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        TextView textAccount;
        TextView textCreateTime;
        RatingBar ratingBar;

        View rootView = LayoutInflater.from(context).inflate(R.layout.layout_encrypt,null);
        textAccount = (TextView) rootView.findViewById(R.id.textAccount);
        textCreateTime = (TextView) rootView.findViewById(R.id.textCreateTime);
        ratingBar = (RatingBar) rootView.findViewById(R.id.ratingBar2);


        textAccount.setText(list.get(i).getAccount());
        textCreateTime.setText(list.get(i).getCreate_time());
        ratingBar.setRating(list.get(i).getLevel());
        //ratingBar.setIsIndicator(true);


        return rootView;
    }
}
